package com.dimeina.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.dimeina.dao.CategoryDAO;
import com.dimeina.dao.impl.CategoryDAOImpl;
import com.dimeina.service.CategoryService;
import com.dimeina.vo.Category;

public class CategoryServiceImpl implements CategoryService, CategoryDAO {
	// 创DAO对象
	CategoryDAO categoryDAOImpl = new CategoryDAOImpl();

	// 获取同级别的所有分类
		public List<Category> findCategoryByPID(int id) {
			List<Category> proList = new ArrayList<Category>();
			try {
				proList = categoryDAOImpl.findCategoryByPID(id);
			} catch (Exception e) {
				System.out.println("搜索所有商品_Service层错误！");
				e.printStackTrace();
			}
			return proList;
		}

		// 根据深度获取所有同级分类
		public List<Category> findCategoryByDepth(int depth) {
			List<Category> proList = new ArrayList<Category>();
			try {
				proList = categoryDAOImpl.findCategoryByDepth(depth);
			} catch (Exception e) {
				System.out.println("根据深度获取所有同级分类_Service层错误！");
				e.printStackTrace();
			}
			return proList;
		}

}
